package com.lorenzogao.controller


import com.lorenzogao.properties.SpringBootProperties
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.web.bind.annotation.*

/**
 * Created by 15270 on 2018/1/23.
 */


@RestController
@RequestMapping("/hello")
class HelloController {


    @Autowired
    private lateinit var springboot: SpringBootProperties;


    //  @PathVariable("id") value = "/say/{id}"   http://localhost:8080/hello/say/100
    //  @RequestParam("id") value = "/say"   http://localhost:8080/hello/say?id=100

    /*
    * (@RequestParam(value = "id",required = false,defaultValue = "0")
    * required = false 是否必传
    * defaultValue 默认值
    * */


//    @RequestMapping(value = "/say", method = arrayOf(RequestMethod.GET, RequestMethod.POST))
    @GetMapping(value = "/say")//get请求
    fun home(@RequestParam(value = "id",required = false,defaultValue = "0") mID: Int): String {
        return "id:" + mID.toString()
    }


}